package org.jie.guider.java.mysql;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author LiJie
 */
public class PropUtil {

    private static Properties prop;

    static {
        prop = new Properties();
        InputStream in = PropUtil.class.getResourceAsStream("/jdbc.properties");
        try {
            prop.load(in);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static String getValue(String key) {
        if (prop == null) {
            throw new NullPointerException("properties is null");
        }
        return prop.getProperty(key);
    }
}
